package com.example.controller;

public class Result {
    private Object data;
    private Integer code;
    private String msg;


    public static Result success(Object data) {
        Result result = new Result();
        result.data = data;
        result.code = 200;
        result.msg = "success";
        return result;
    }

    public static Result failure(int code, String msg) {
        Result result = new Result();
        result.code = code;
        result.msg = msg;
        result.data = null; // 可选：失败时一般不返回数据
        return result;
    }


    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }
}
